listbox: Add preconditions to remove()
authorTimm Bäder <mail@baedert.org>
Fri, 4 Sep 2020 06:48:45 +0000 (08:48 +0200)
committerTimm Bäder <mail@baedert.org>
Tue, 15 Sep 2020 03:21:53 +0000 (05:21 +0200)
gtk/gtklistbox.c

index 73a8995608996cd5e4bca530c8e013db3435b552..b028df0f1168e482c675a2f7c97205caee87bff1 100644 (file)
@@ -2272,16 +2272,20 @@ gtk_list_box_row_visibility_changed (GtkListBox    *box,
  * Removes a child from @box.
  */
 void
-gtk_list_box_remove (GtkListBox   *box,
-                     GtkWidget    *child)
+gtk_list_box_remove (GtkListBox *box,
+                     GtkWidget  *child)
 {
-  GtkWidget *widget = GTK_WIDGET (box);
+  GtkWidget *widget;
   gboolean was_visible;
   gboolean was_selected;
   GtkListBoxRow *row;
   GSequenceIter *iter;
   GSequenceIter *next;
 
+  g_return_if_fail (GTK_IS_LIST_BOX (box));
+  g_return_if_fail (GTK_IS_WIDGET (child));
+
+  widget = GTK_WIDGET (box);
   was_visible = gtk_widget_get_visible (child);
 
   if (child == box->placeholder)